#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string.h>
using namespace std;
class Solution {
public:
    string reverse_left(string s,int left,int right)
    {
        
        while (left < right)
        {
            char a;
            a = s[left];
            s[left] = s[right];
            s[right] = a;
            left++;
            right--;
        }
        return s;
    }
    
    string reverseLeftWords(string s, int n) {
        s=reverse_left(s, 0, n - 1);
        s=reverse_left(s, n, s.length() - 1);
        s=reverse_left(s, 0, s.length() - 1);
        return s;
    }
};
int main()
{
    Solution s1;
    auto s2=s1.reverseLeftWords("abcdefg", 2);
    cout << s2;
}